<?php
class koudaiControl extends skymvc{
	public $koudaiid;
	public function __construct(){
		parent::__construct();		 
	}
	
	public function onInit(){
		$koudai=M("login")->getkoudaiAdmin();
	}
	
	public function onDefault(){
		 $data=M("koudai")->selectRow(array("where"=>"id=".SHOPID)); 
		 
		$this->smarty->assign(array(
			"data"=>$data,			 			 
		));
		$this->smarty->display("koudai/add.html");
	}
	
	
	public function onPlugin(){
		$shopid=SHOPID;
		
		if($shopid){
			$data=M("koudai")->selectRow(array("where"=>"id={$shopid}"));
			
			$this->smarty->assign(array(
				"data"=>$data
			));
		}
		$this->smarty->display("koudai/plugin.html");
	}
	
	public function onPluginSave(){
		$shopid=SHOPID;
		$data=M("koudai")->postData(); 
		M("koudai")->update($data,"id='$shopid'");
		$this->goall("保存成功");
	}
	
	public function onSave(){
			$data=M("koudai")->postData();
			M("koudai")->update($data,"id=".SHOPID)	;	
			$this->goall("保存成功");
	}
	
}
?>